local weizheng = fk.CreateSkill {
  name = "ls__weizheng",
}

Fk:loadTranslationTable{
  ["ls__weizheng"] = "维整",
  [":ls__weizheng"] = "一名角色的回合开始时，若其无策略，你可令其重置策略，若其仍无策略，你重置“掌筹”，否则其选择一项：1.失去1点体力；2.令你回复1点体力。",
  ["#ls__weizheng-invoke"] = "维整：你可令%src重置策略",
  ["ls__weizheng1"] = "失去1点体力",
  ["ls__weizheng2"] = "令%src回复1点体力",
  ["@[player]weizheng"] = "维整",

  ["$ls__weizheng1"] = "解危策敌，计定山河。",
  ["$ls__weizheng2"] = " 一石二鸟，方为上策。",
}

local ls = require "packages/lvshi/utility"

weizheng:addEffect(fk.TurnStart, {
  anim_type = "defensive",
  can_trigger = function(self, event, target, player, data)
    return player:hasSkill(weizheng.name) and ls.getStrategy(target, false) == "none"
  end,
  on_cost = function(self, event, target, player, data)
    return player.room:askToSkillInvoke(player, { skill_name = weizheng.name, prompt = "#ls__weizheng-invoke:".. target.id })
  end,
  on_use = function(self, event, target, player, data)
    ls.setStrategy(target, ls.getTrueStrategy(target))
    if ls.getStrategy(target, false) == "none" then
      player.room:validateSkill(player, "ls__zhangchou", "-round")
    else
      local choices = {"ls__weizheng1"}
      if player:isWounded() then table.insert(choices, "ls__weizheng2:"..player.id) end
      local choice = player.room:askToChoice(target, {choices = choices, skill_name = weizheng.name})
      if choice == "ls__weizheng1" then
        player.room:loseHp(target, 1, weizheng.name)
      else
        player.room:recover{ who = player, num = 1, skillName = weizheng.name }
      end
    end
  end,
})

return weizheng